/* MyVoyageBoard split stylesheet: styles-core.css
   Core shell, dashboard/trips base, planner base, maps/modals foundation
   Preserves original cascade order from styles.css. */

/* =========================
  THEME TOKENS (Dark default)
========================== */
:root{
  --radius-lg:14px; --radius-sm:8px; --radius-xl:24px;
  --shadow-soft:0 18px 40px rgba(0,0,0,.35);

  --accent:#22aeea;
  --accent-2:#075ba9;
  --success:#22c55e;
  --danger:#f97373;

  --text:#e5e7eb;
  --muted:#9ca3af;

  --page-bg: radial-gradient(circle at top, #0a2540 0, #031120 55%);
  --shell-bg: linear-gradient(145deg, #06182b 0, #071526 42%, #031120 100%);
  --shell-border: rgba(148,163,184,.25);

  --card-bg:
    radial-gradient(circle at top left, rgba(56,189,248,.08), transparent 45%),
    radial-gradient(circle at bottom right, rgba(8,120,189,.10), transparent 50%),
    #0d2035;
  --card-border: rgba(148,163,184,.30);
  --card-shadow: 0 10px 30px rgba(0,0,0,.35);

  --surface: rgba(7,21,38,.92);
  --surface-2: rgba(8,25,44,.98);
  --surface-border: rgba(148,163,184,.60);
  --surface-border-2: rgba(75,85,99,.90);

  --row-bg:
    radial-gradient(circle at top left, rgba(56,189,248,.13), transparent 55%),
    rgba(15,23,42,.95);
  --row-border: rgba(55,65,81,.90);

  --kpi-bg: linear-gradient(135deg, rgba(10,29,50,.94), rgba(6,22,39,.99));
  --kpi-border: rgba(148,163,184,.35);
  --kpi-shadow: 0 10px 26px rgba(0,0,0,.40);

  --chip-bg: rgba(15,23,42,.80);
  --tabs-bg: rgba(7,24,43,.90);
  --link-bg: rgba(15,23,42,.90);

  --input-bg: rgba(15,23,42,.98);
  --input-focus: rgba(15,23,42,1);

  --shell-glow:
    radial-gradient(circle at 0% 0%, rgba(56,189,248,.20), transparent 55%),
    radial-gradient(circle at 100% 0%, rgba(8,120,189,.16), transparent 60%);
  --shell-glow-opacity:.35;

  --border: rgba(148,163,184,.22);
}

/* Light mode swaps variables only */
body.light{
  --text:#020617;
  --muted:#4b5563;

  --page-bg: radial-gradient(circle at top, #eaf7ff 0, #f7fbff 58%);
  --shell-bg: linear-gradient(145deg, #ffffff 0, #eef8ff 100%);
  --shell-border: rgba(148,163,184,.50);

  --card-bg:
    radial-gradient(circle at top left, rgba(59,130,246,.10), transparent 55%),
    #ffffff;
  --card-border: rgba(148,163,184,.60);
  --card-shadow: 0 10px 28px rgba(7,91,169,.08);

  --surface: rgba(255,255,255,.85);
  --surface-2: rgba(255,255,255,.92);
  --surface-border: rgba(148,163,184,.65);
  --surface-border-2: rgba(148,163,184,.65);

  --row-bg: rgba(255,255,255,.92);
  --row-border: rgba(148,163,184,.65);

  --kpi-bg: rgba(255,255,255,.92);
  --kpi-border: rgba(148,163,184,.65);
  --kpi-shadow: 0 10px 26px rgba(15,23,42,.10);

  --chip-bg: rgba(255,255,255,.85);
  --tabs-bg: rgba(255,255,255,.85);
  --link-bg: rgba(255,255,255,.85);

  --input-bg: rgba(255,255,255,.92);
  --input-focus: rgba(255,255,255,1);

  --shell-glow-opacity:.22;
}
/* Light mode: improve Edit Trip helper text readability */
body.light .hint,
body.light .help-text,
body.light #form-subtitle,
body.light #autosave-status,
body.light .trip-modal-body #trip-form-card .card-header small{
  color: #475569; /* slate-600 */
  font-weight: 500;
  opacity: 1;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"SF Pro Text",sans-serif;
  background: var(--page-bg);
  color: var(--text);
  min-height:100vh;
  display:flex;
  justify-content:center;
  padding:clamp(8px,3vw,20px);
}

.app-shell{
  width:100%;
  max-width:1800px;
  background: var(--shell-bg);
  border-radius: var(--radius-xl);
  border:1px solid var(--shell-border);
  box-shadow: var(--shadow-soft);
  padding:20px 20px 16px;
  position:relative;
  overflow:hidden;
}
.app-shell::before{
  content:"";
  position:absolute;
  inset:0;
  background: var(--shell-glow);
  opacity: var(--shell-glow-opacity);
  pointer-events:none;
}
.app-inner{
  position:relative;
  z-index:1;
  display:flex;
  flex-direction:column;
  min-height:100%;
}
main{
  flex: 1 1 auto;
}

.site-footer{
  margin-top: auto;
  width: 100%;
  text-align: center;
  padding: 12px 8px;
  font-size: 0.8rem;
  color: var(--muted);
}


header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:12px;
  gap:12px;
}

.title{ display:flex; flex-direction:column; gap:2px; }
.title h1{
  margin:0;
  font-size:clamp(1rem,1.2vw + .9rem,1.4rem);
  letter-spacing:.03em;
  display:flex;
  align-items:center;
  gap:10px;
}
.title small{ font-size:.78rem; color:var(--muted); }

.logo-img{
  width:56px;
  height:56px;
  border-radius:8px;
  object-fit:cover;
  box-shadow:0 0 24px rgba(56,189,248,.35);
}

.header-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
/* header: title left, actions right */
header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}

/* RIGHT stacked column */
.header-actions{
  margin-left:auto;
  display:flex;
  flex-direction:column;     /* stack */
  align-items:flex-end;       /* right align items */
  gap:10px;
  width:fit-content;          /* don't fill the whole header */
}

/* keep the tabs row right sized */
.header-actions .tabs{
  width:fit-content;
  max-width:100%;
  justify-content:flex-end;
}

/* backup/action rows */
.action-stack{
  display:flex;
  flex-direction:column;
  gap:8px;
  align-items:flex-end;
  width:fit-content;
}

.action-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
  width:fit-content;
}

/* prevent buttons from stretching wide */
.header-actions .btn,
.header-actions .pill-link{
  width:auto;
}
@media (max-width:1400px){
  header{ flex-direction:column; }
  .header-actions{ align-self:flex-end; } /* keep it pinned to right */
}


.chip{
  font-size:.7rem;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid var(--surface-border);
  color:var(--muted);
  background: var(--chip-bg);
  backdrop-filter: blur(12px);
  display:inline-flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}
.chip-dot{
  width:6px;height:6px;border-radius:999px;
  background:#4ade80;
  box-shadow:0 0 10px rgba(74,222,128,.9);
}

.tabs{
  display:inline-flex;
  border-radius:999px;
  padding:3px;
  background: var(--tabs-bg);
  border:1px solid var(--surface-border);
  backdrop-filter: blur(12px);
}
.tab-btn{
  border:none;
  background:transparent;
  color:var(--muted);
  padding:6px 14px;
  font-size:.8rem;
  border-radius:999px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:6px;
  transition:all .2s ease;
}
.tab-btn.active{
  background: radial-gradient(circle at top left, var(--accent), #0ea5e9);
  color:#fff;
  box-shadow:0 0 20px rgba(56,189,248,.55);
}
.tab-btn .icon{ font-size:.9rem; }
.tabs a.tab-btn{ text-decoration:none; }

/* Pulse the Alerts icon on desktop when checklist issues exist */
.tab-btn.has-alerts[data-tab="checklist"] .icon{
  animation: alertsPulse 1.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce){
  .tab-btn.has-alerts[data-tab="checklist"] .icon{ animation: none; }
}

.pill-link{
  font-size:.7rem;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--surface-border);
  color:var(--muted);
  background: var(--link-bg);
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:6px;
  transition:all .18s ease;
  white-space:nowrap;
  cursor:pointer;
}
.pill-link:hover{ filter: brightness(1.03); color: var(--text); }

main{ margin-top:12px; }

#view-dashboard .grid{
  display:grid;
  gap:14px;
  /* Screenshot-style dashboard: stacked cards, centered */
  grid-template-columns: 1fr;
  max-width: 1120px;
  margin: 0 auto;
}

/* KPI layout: 5 across on desktop (2 rows for 10 KPIs), scales down on smaller screens */
#view-dashboard .kpi-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(220px,1fr));
  gap:12px;
}

.kpi{
  background: var(--kpi-bg);
  border-radius:14px;
  padding:12px 14px;
  border:1px solid var(--kpi-border);
  box-shadow: var(--kpi-shadow);
  position:relative;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  min-height:116px;
}
.kpi::before{
  content:"";
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:3px;
  border-radius:14px 14px 0 0;
  background:linear-gradient(90deg,#38bdf8,#0878bd);
  opacity:.95;
  pointer-events:none;
}
body.light .kpi::before{ opacity:.85; }

.kpi-label{
  font-size:.72rem;
  line-height:1.1;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--muted);
  min-height:16px;
  margin-bottom:6px;
}
.kpi-value{
  margin-top:0;
  font-size:2rem;
  line-height:1.05;
  font-weight:800;
  min-height:42px;
  display:flex;
  align-items:center;
  color:var(--text);
}
.kpi-sub{
  margin-top:4px;
  font-size:.82rem;
  line-height:1.25;
  color:var(--muted);
  min-height:20px;
}

@media (max-width:1400px){
  #view-dashboard .kpi-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px){
  #view-dashboard .kpi-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap:10px; }
  .kpi{ padding:10px 12px; min-height:104px; }
  .kpi-label{ margin-bottom:3px; }
  .kpi-value{ font-size:1.65rem; min-height:30px; }
  .kpi-sub{ font-size:.76rem; min-height:16px; }
}

.kpi-pill{
  position:absolute;
  right:8px; top:8px;
  font-size:.7rem;
  padding:3px 8px;
  border-radius:999px;
  background: var(--surface);
  border:1px solid var(--surface-border);
  color:var(--muted);
  display:inline-flex;
  align-items:center;
  gap:4px;
}
.kpi-pill .dot{
  width:7px;height:7px;border-radius:999px;
  background: var(--success);
  box-shadow:0 0 8px rgba(34,197,94,.9);
}

.trip-list{
  max-height: min(80vh, 1100px);
  overflow: auto;
  padding-right: 4px;
  margin-top: 2px;
  scrollbar-width: thin;
}
/* ===== Dashboard — show ALL upcoming trips (no internal scroll) ===== */
#view-dashboard .trip-list{
  max-height: none !important;
  overflow: visible !important;
}
/* ===== Trips tab — show ALL trips (no internal scroll) ===== */
#view-trips .trip-list{
  max-height: none !important;
  overflow: visible !important;
  padding-right: 0 !important;
}

/* Big screens: show even more */
@media (min-width: 1100px){
  .trip-list{
    max-height: min(78vh, 980px);
  }
}


.trip-row{
  border-radius:10px;
  padding:8px 9px;
  border:1px solid var(--row-border);
  background: var(--row-bg);
  margin-bottom:7px;
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  box-shadow: 0 10px 26px rgba(15,23,42,.08);
}
.trip-main{ flex:1; }
.trip-name{ font-size:.9rem; font-weight:600; margin-bottom:2px; }
.trip-meta{
  font-size:.75rem;
  color:var(--muted);
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}



/* Trips tab compact icon guide */
.trip-meta-help-btn{
  appearance:none;
  border:1px solid rgba(148,163,184,.55);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--muted);
  width:18px;
  height:18px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
  font-size:.68rem;
  font-weight:900;
  line-height:1;
  cursor:pointer;
  box-shadow:0 3px 8px rgba(15,23,42,.08);
}
.trip-meta-help-btn:hover{
  color:var(--accent);
  border-color:color-mix(in srgb, var(--accent) 55%, rgba(148,163,184,.55));
  transform:translateY(-1px);
}
.trip-meta-help-modal .status-help-item{
  padding:5px 0;
}

.trip-flights{
  margin-top:6px;
  display:grid;
  gap:5px;
}

.trip-flight-row{
  border:1px solid rgba(148,163,184,.35);
  background: rgba(255,255,255,.48);
  border-radius:999px;
  padding:5px 6px 5px 9px;
  display:grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items:center;
  gap:8px;
  box-shadow:none;
}

.trip-flight-left{
  min-width:0;
  display:flex;
  align-items:center;
  gap:6px;
}

.trip-flight-title{
  font-weight:650;
  font-size:.76rem;
  color: var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.trip-flight-sub{
  order:-1;
  flex:0 0 auto;
  font-size:.64rem;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color: var(--muted);
  margin-top:0;
}

.trip-flight-actions{
  display:flex;
  gap:4px;
  align-items:center;
}

.trip-flight-actions .btn{
  min-height:24px;
  padding:3px 8px;
  font-size:.68rem;
  border-radius:999px;
}

.trip-flight-note{
  display:none;
}

.trip-flight-note.warn{
  display:block;
  grid-column:1 / -1;
  font-size:.68rem;
  color: var(--warn);
  padding-left:2px;
}

.trip-flight-row .btn[disabled]{
  opacity:.55;
  cursor:not-allowed;
}

@media (max-width: 640px){
  .trip-flight-row{
    border-radius:14px;
    grid-template-columns: 1fr;
    align-items:flex-start;
  }
  .trip-flight-left{
    width:100%;
  }
  .trip-flight-actions{
    width:100%;
  }
  .trip-flight-actions .btn{
    flex:1;
  }
}


.badge{
  padding:2px 6px;
  border-radius:999px;
  border:1px solid var(--surface-border);
  font-size:.72rem;
  background: var(--surface);
  color: var(--muted);
}

#view-ports .trip-list{ max-height:none; overflow:visible; padding-right:0; }
#view-ports .trip-row{ padding:6px 8px; margin-bottom:6px; }
#view-ports .trip-name{ font-size:.88rem; }
#view-ports .trip-meta{ gap:6px; font-size:.72rem; }

.trip-actions{ display:flex; flex-direction:column; gap:4px; }

.btn{
  border:none;
  border-radius:999px;
  padding:5px 10px;
  font-size:.7rem;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  background: var(--surface);
  color: var(--muted);
  border:1px solid var(--surface-border);
  transition:all .18s ease;
  text-decoration:none;
  white-space:nowrap;
}
.btn:hover{ filter: brightness(1.03); color: var(--text); }

.btn-primary{
  background: linear-gradient(135deg, #0ea5e9, var(--accent));
  border-color:transparent;
  color:#fff;
  box-shadow:0 0 16px rgba(56,189,248,.55);
}
.btn-primary:hover{ filter: brightness(1.05); }

.btn-danger{
  border-color: rgba(248,113,113,.70);
  color: #fecaca;
}
body.light .btn-danger{ color:#b91c1c; border-color: rgba(239,68,68,.55); }
.btn-danger:hover{ background: rgba(239,68,68,.10); }

form{ display:flex; flex-direction:column; gap:8px; margin-top:4px; }
.field-row{ display:flex; gap:8px; flex-wrap:wrap; }
.field{ display:flex; flex-direction:column; gap:3px; flex:1; }
.field-row .field{ flex:1 1 160px; }

label{ font-size:.7rem; color:var(--muted); }

/* Ship list status note (next to Ship label) */
.ship-status{
  margin-left: 8px;
  font-size: .68rem;
  color: var(--muted);
  font-weight: 600;
}
.ship-status.ok{ color: var(--success); }
.ship-status.warn{ color: var(--warn, #fb923c); }

input, textarea, select{
  border-radius: var(--radius-sm);
  border:1px solid var(--surface-border-2);
  padding:5px 8px;
  background: var(--input-bg);
  color: var(--text);
  font-size:.78rem;
  font-family:inherit;
  outline:none;
  transition:border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input:focus, textarea:focus{
  border-color: var(--accent);
  box-shadow:0 0 0 1px rgba(56,189,248,.55);
  background: var(--input-focus);
}
textarea{ resize:vertical; min-height:60px; }

.form-footer{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:2px;
  gap:8px;
  flex-wrap:wrap;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-size:.7rem;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid var(--surface-border);
  background: var(--surface);
  color: var(--muted);
}
.pill-dot{ width:6px;height:6px;border-radius:999px; }
.pill-dot.green{ background:#22c55e; }
.pill-dot.orange{ background:#fb923c; }

.ports-list{ display:flex; flex-wrap:wrap; gap:6px; margin-bottom:6px; }
.port-pill{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--surface-border);
  font-size:.74rem;
  background: var(--surface);
  color: var(--muted);
}

.port-name{ font-weight:650; color: var(--text); }

.port-actions{ display:inline-flex; align-items:center; gap:6px; }
.port-btn{
  border:1px solid var(--surface-border);
  background: var(--card-bg);
  color: var(--text);
  cursor:pointer;
  padding:6px 8px;
  border-radius:10px;
  font-size:.78rem;
  line-height:1;
  min-width:36px;
  min-height:32px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.port-btn:active{ transform: translateY(1px); }
.port-btn.danger{ color:#ef4444; }

.port-pill button{ /* legacy safety */
  border:none;
  background:transparent;
}

.port-hide-toggle{
  display:inline-flex;
  align-items:center;
  gap:4px;
  margin-left:6px;
  font-size:.68rem;
  color: var(--muted);
  user-select:none;
}
.port-hide-toggle input{ transform: translateY(1px); cursor:pointer; }

/* =========================
  TRIP ADD-ONS (WiFi / Starbucks / Vibe)
========================== */
.addons{
  border:1px solid var(--surface-border);
  background: linear-gradient(135deg, rgba(56,189,248,.08), rgba(8,120,189,.08));
  border-radius:16px;
  padding:10px;
  margin-top:6px;
}
.addons-title{
  font-weight:750;
  font-size:.82rem;
  letter-spacing:.01em;
  margin-bottom:8px;
  color: var(--text);
}
.addons-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:8px;
}
.addon-toggle{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 10px;
  border-radius:14px;
  border:1px solid var(--surface-border);
  background: var(--card-bg);
  cursor:pointer;
  user-select:none;
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
}
.addon-toggle input{ display:none; }
.addon-chip{
  width:34px;
  height:34px;
  border-radius:12px;
  border:1px solid var(--surface-border);
  background: var(--surface);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}
.addon-icon{ width:18px; height:18px; object-fit:contain; display:block; }
.addon-text{ font-weight:700; font-size:.82rem; color: var(--text); }
.addon-toggle:has(input:checked){
  border-color: rgba(56,189,248,.75);
  box-shadow: 0 0 0 2px rgba(56,189,248,.25), 0 10px 28px rgba(0,0,0,.22);
}
.addon-toggle:has(input:checked) .addon-chip{
  border-color: rgba(56,189,248,.75);
  background: rgba(56,189,248,.16);
}
.addons-extra{ margin-top:10px; }

@media (max-width:600px){
  .ports-list{ gap:10px; }
  .port-pill{ width:100%; justify-content:space-between; border-radius:16px; }
  .port-actions{ gap:8px; }
  .port-btn{ min-width:44px; min-height:40px; border-radius:12px; }
  .port-hide-toggle{ margin-left:0; }

  .addons-grid{ grid-template-columns: 1fr; }
  .addon-toggle{ padding:12px; }
  .addon-chip{ width:40px; height:40px; border-radius:14px; }
  .addon-text{ font-size:.92rem; }
}

.help-text{ font-size:.68rem; color:var(--muted); margin-top:2px; }
.empty{ font-size:.78rem; color:var(--muted); margin-top:6px; }

/* =========================
  LOGIN MODAL
========================== */
.modal-backdrop{
  position:fixed; inset:0; z-index:999999;
  background: rgba(0,0,0,.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
}
.modal{
  width:min(520px, 100%);
  background: var(--card-bg);
  border:1px solid var(--card-border);
  border-radius:18px;
  box-shadow: var(--shadow-soft);
  padding:14px;
}
.modal h3{
  margin:0 0 6px;
  font-size:1rem;
  letter-spacing:.02em;
}
.modal p{
  margin:0 0 10px;
  color: var(--muted);
  font-size:.82rem;
  line-height:1.35;
}
.modal .row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
  margin-top:10px;
}
.username-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:.7rem;
  padding:3px 10px;
  border-radius:999px;
  border:1px solid var(--surface-border);
  color:var(--muted);
  background: var(--chip-bg);
  white-space:nowrap;
}

/* Dashboard trip notes timer */
.trip-inline-timer{ margin-top:6px; }
.trip-inline-timer .countdown{
  font-size:1.05rem;
  font-weight:650;
  margin-top:2px;
}
.trip-inline-timer .count-label{
  font-size:.78rem;
  color:var(--muted);
  margin-top:2px;
  margin-bottom:10px;
}

/* Site footer */
.site-footer{
  margin-top: 28px;
  padding: 14px 10px;
  text-align: center;
  font-size: 13px;
  color: var(--muted, #9ca3af);
  border-top: 1px solid var(--border, rgba(148,163,184,.22));
}
.site-footer a{
  color: var(--accent, #38bdf8);
  text-decoration: none;
  font-weight: 500;
}
.site-footer a:hover{
  text-decoration: underline;
}
.footer-sep{
  margin: 0 8px;
  opacity: 0.6;
}

@media (max-width:1400px){
  body{ padding:12px; }
  .app-shell{ padding:14px 14px 12px; border-radius:18px; }
  header{ flex-direction:column; align-items:flex-start; gap:8px; }
  .header-actions{ width:100%; justify-content:space-between; }
  
}
@media (max-width:600px){
  body{ padding:10px; }
  .app-shell{ padding:10px 10px 12px; border-radius:14px; }
  .title h1{ font-size:clamp(.95rem,3.5vw,1.2rem); }
  .title small{ font-size:.7rem; }
  .chip{ width:100%; justify-content:center; }
  .tabs{ width:100%; justify-content:space-between; }
  .tab-btn{ flex:1; justify-content:center; padding:6px 8px; font-size:.75rem; }
  .grid{ gap:10px; }
  .card-header{ flex-direction:column; align-items:flex-start; gap:4px; }
  .trip-row{ flex-direction:column; }
  .trip-actions{ flex-direction:row; width:100%; flex-wrap:wrap; }
  .trip-actions .btn{ flex:1 1 120px; }
  input, textarea{ font-size:.76rem; }
  .field-row{ flex-direction:column; }
}


/* Excursion notes: show first 2 lines with expand */
.exc-notes-clamp{
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.exc-notes-full{ }
.exc-notes-toggle{
  margin-top:6px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--surface-border);
  background: var(--surface);
  font-size:.72rem;
  color:var(--accent);
  cursor:pointer;
  user-select:none;
}


/* Wider layout for Trips tab (All Trips + Add Voyage cards) */
#view-trips .grid{
  grid-template-columns: 1.25fr 1fr;
}
@media (max-width: 912px){
  #view-trips .grid{ grid-template-columns: 1fr; }
}

.exc-notes{ white-space: pre-wrap; }


/* === Trip Planner (embedded) styling === */

.trip-planner{ margin-top:10px; }
.trip-planner details{
  border:1px solid var(--border);
  border-radius:16px;
  background: var(--surface);
  padding:10px;
}
.trip-planner summary{
  cursor:pointer;
  font-weight:750;
  letter-spacing:.01em;
  list-style:none;
  padding:10px 12px;
  border-radius:14px;
  background:
    radial-gradient(circle at top left, rgba(56,189,248,.12), transparent 55%),
    radial-gradient(circle at top right, rgba(8,120,189,.12), transparent 60%),
    var(--surface-2);
  border:1px solid rgba(148,163,184,.18);
  user-select:none;
}
.trip-planner summary::-webkit-details-marker{ display:none; }
.trip-planner details[open] summary{ margin-bottom:10px; }



/* Trip Planner: Excursions narrow (right), Daily Agenda wide (left) */
.trip-planner .planner-sections{
  grid-template-columns: 1fr minmax(240px, 340px) !important;
}

@media (max-width:980px){
  
}

@media (max-width:980px){
  .planner-sections{ grid-template-columns:1fr; }
}

.planner-section{
  border:1px solid rgba(148,163,184,.18);
  border-radius:16px;
  background:
    radial-gradient(circle at top left, rgba(56,189,248,.10), transparent 55%),
    var(--surface-2);
  padding:12px;
}
.planner-section h4{
  margin:0 0 10px;
  font-size:.8rem;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--muted);
}

.planner-list{ display:flex; flex-direction:column; gap:8px; }

.planner-item{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:10px;
  border-radius:14px;
  border:1px solid rgba(148,163,184,.18);
  background: rgba(15,23,42,.60);
}
body.light .planner-item{ background: rgba(255,255,255,.75); }

.planner-check{ transform: translateY(2px); cursor:pointer; }
.planner-text{ flex:1; min-width:0; }
.planner-title{
  font-weight:750;
  font-size:.92rem;
  margin:0;
  line-height:1.2;
}
.planner-title a{
  color:var(--accent);
  text-decoration:underline;
  text-underline-offset:3px;
}
.planner-sub{
  margin-top:4px;
  color:var(--text);
  opacity:.92;
  font-size:.82rem;
  line-height:1.25;
  word-break:break-word;
}
.planner-sub.muted{ color:var(--muted); opacity:1; }

.planner-actions{ display:flex; gap:8px; align-items:flex-start; }
.planner-actions .btn{ padding:6px 10px; }
.planner-actions .btn.btn-danger{ padding:6px 10px; }

.planner-add{
  margin-top:10px;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  align-items:center;
}
.planner-add input, .planner-add select{ width:100%; }
.planner-add .btn{ justify-self:start; }
@media (max-width:600px){
  .planner-add{ grid-template-columns:1fr; }
  .planner-add .btn{ width:100%; }
}

.planner-mini-note{
  margin-top:10px;
  font-size:.72rem;
  color:var(--muted);
}

/* Daily Agenda columns */
.agenda-days{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:10px;
  margin-top:4px;
}
.agenda-day{
  border:1px solid rgba(148,163,184,.18);
  border-radius:16px;
  background: rgba(15,23,42,.55);
  padding:10px;
}
body.light .agenda-day{ background: rgba(255,255,255,.75); }
.agenda-day h5{
  margin:0 0 8px;
  font-size:.78rem;
  color:var(--muted);
  letter-spacing:.10em;
  text-transform:uppercase;
}


/* Agenda day card (FIX: mobile box missing) */
.agenda-day-card{
  border:1px solid rgba(148,163,184,.18);
  border-radius:16px;
  background: rgba(15,23,42,.55);
  padding:10px;
}

body.light .agenda-day-card{ background: rgba(255,255,255,.75); }

.agenda-day-title{
  margin:0 0 8px;
  font-size:.78rem;
  color:var(--muted);
  letter-spacing:.10em;
  text-transform:uppercase;
  font-weight:750;
}

.agenda-drop{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-height:40px;
  padding:8px;
  border-radius:12px;
  border:1px dashed rgba(148,163,184,.25);
  background: rgba(2,6,23,.10);
}
body.light .agenda-drop{ background: rgba(2,6,23,.04); }

.agenda-drag{
  cursor:grab;
  font-size:18px;
  line-height:1;
  opacity:.8;
  margin-right:4px;
  user-select:none;
}


/* =========================
   Daily Agenda - flat list styling
========================= */
.agenda-drop-flat{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  background:rgba(2,6,23,.35);
}

.ag-pill{
  display:inline-flex;
  align-items:center;
  padding:2px 10px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.28);
  background:rgba(15,23,42,.55);
  font-weight:700;
  letter-spacing:.2px;
}

.ag-time{
  opacity:.9;
  font-weight:600;
}

.planner-item.agenda-item .planner-sub{
  margin-top:6px;
}

.planner-item.agenda-item .planner-actions{
  display:flex;
  gap:8px;
  align-items:center;
}

/* =========================
   Daily Agenda inline edit mode
========================= */
.agenda-item .ag-editform{ display:none; margin-top:10px; }


.agenda-item.is-editing .ag-actions{ display:none; }

.ag-editform .ag-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:10px;
}
@media (max-width:520px){
  .ag-editform .ag-grid{ grid-template-columns:1fr; }
}

.ag-editform textarea.ag-in-notes{
  margin-top:10px;
  min-height:64px;
  resize:vertical;
}

.ag-edit-actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  margin-top:10px;
}



/* =========================
  PLANNER POLISH
========================== */
.exc-notes-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 10px;
  margin-top:6px;
  border-radius:999px;
  border:1px solid var(--surface-border);
  background: var(--surface);
  color: var(--muted);
  font-size:.72rem;
  cursor:pointer;
  user-select:none;
}
.exc-notes-toggle:hover{ color: var(--text); filter: brightness(1.03); }

.agenda-item{ position:relative; }
.agenda-item .planner-actions{ display:flex; gap:6px; align-items:center; }

.ag-editform{
  display:none;
  width:100%;
  margin-top:8px;
  padding-top:8px;
  border-top:1px solid var(--surface-border);
}
.agenda-item.is-editing .ag-view{ display:none; }
.agenda-item.is-editing .ag-editform{ display:block; }

.ag-grid{
  display:grid;
  grid-template-columns: 1.2fr 1fr 2fr 1fr;
  gap:8px;
  margin-bottom:8px;
}
@media (max-width: 680px){
  .ag-grid{ grid-template-columns: 1fr 1fr; }
}
.ag-editform input, .ag-editform textarea{
  width:100%;
  border-radius:12px;
  padding:8px 10px;
  border:1px solid var(--surface-border);
  background: rgba(255,255,255,.03);
  color: var(--text);
  outline:none;
}
body.light .ag-editform input, body.light .ag-editform textarea{
  background: rgba(0,0,0,.03);
  color: var(--text);
}
.ag-editform textarea{ min-height:64px; resize:vertical; }



/* Agenda inline edit buttons */
.icon-btn{
  width:36px;
  height:36px;
  border-radius:999px;
  display:grid;
  place-items:center;
  border:1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.28);
  color: var(--text);
  cursor:pointer;
  flex:0 0 auto;
}
.icon-btn:hover{ border-color: rgba(56,189,248,.45); }
.icon-btn:active{ transform: translateY(1px); }
body.light .icon-btn{ background: rgba(255,255,255,.65); }

.agenda-edit-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:8px;
  width:100%;
}
.agenda-edit-grid input{
  width:100%;
  min-width:0;
}
@media (max-width: 560px){
  .agenda-edit-grid{ grid-template-columns: 1fr; }

.exc-edit-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:8px;
  width:100%;
}
.exc-edit-grid input, .exc-edit-grid select{
  width:100%;
  min-width:0;
}
@media (max-width: 560px){
  .exc-edit-grid{ grid-template-columns: 1fr; }
}
}
/* =========================
   MOBILE: SINGLE COLUMN
========================== */
@media (max-width: 768px) {
  /* Dashboard + Trips grids */
  #view-dashboard .grid,
  #view-trips .grid {
    grid-template-columns: 1fr;
  }
}


/* =========================
   Daily Agenda: 2 columns on desktop
   (keeps 1 column on smaller screens)
========================== */
@media (min-width: 1000px){
  .trip-planner .agenda-days{
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}
@media (max-width: 999px){
  .trip-planner .agenda-days{
    grid-template-columns: 1fr;
  }
}

/* Trip planner + deck buttons */
.trip-planner-buttons{
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.trip-planner-details > summary,
.trip-planner-deck-btn{
  list-style: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 10px 14px;
  border: 1px solid var(--surface-border);
  background: linear-gradient(135deg, rgba(56,189,248,.12), rgba(8,120,189,.12));
  color: var(--text);
  font-weight: 650;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  transition: all .18s ease;
  text-decoration: none;
  display: block;
}

.trip-planner-details > summary:hover,
.trip-planner-deck-btn:hover{
  filter: brightness(1.08);
}
/* Make Trip Planner and Deck Plan buttons EXACT same size */
.trip-planner-details > summary,
.trip-planner-deck-btn{
  height: 44px;                 /* force same height */
  display: flex;               /* align icon + text same way */
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  box-sizing: border-box;
}

/* Remove default marker spacing differences */
.trip-planner-details > summary::-webkit-details-marker{
  display: none;
}
.trip-planner-details > summary::marker{
  content: "";
}
/* KPI cards: align number under title nicely */
.kpi,
.kpi-card{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Make sure the big number block aligns left */
.kpi .kpi-value,
.kpi-card .kpi-value,
.kpi .value,
.kpi-card .value{
  align-self: flex-start;
}




/* Branded login modal polish */
.login-modal form{
  margin:0;
}
.login-brand-header{
  text-align:center;
  margin:0 0 18px;
}
.login-brand-icon{
  width:72px !important;
  height:72px !important;
  max-width:72px !important;
  max-height:72px !important;
  object-fit:cover;
  display:block;
  margin:0 auto 12px;
  border-radius:22px;
  box-shadow:0 14px 34px rgba(34,174,234,.28), 0 0 0 1px rgba(255,255,255,.28);
}
.login-brand-header h3{
  margin:0;
}
.login-brand-subtitle{
  margin:6px 0 0 !important;
  font-size:.92rem;
  opacity:.78;
}
.login-hidden-submit{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}
@media (max-width:640px){
  .login-brand-icon{
    width:64px !important;
    height:64px !important;
    max-width:64px !important;
    max-height:64px !important;
    border-radius:20px;
  }
}

/* Login modal: 3 buttons (Local / Demo / Continue) wrap nicely */
.login-actions{ flex-wrap:wrap; }
.login-actions .btn{ flex:1 1 140px; }





/* =========================
   PWA-style full-screen onboarding login
========================== */
#login-backdrop{
  padding: clamp(16px, 4vw, 42px);
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  background:
    radial-gradient(circle at 18% 8%, rgba(34,174,234,.36), transparent 34%),
    radial-gradient(circle at 84% 16%, rgba(143,220,255,.22), transparent 32%),
    linear-gradient(145deg, rgba(4,18,34,.92), rgba(8,44,72,.88) 46%, rgba(3,13,27,.96));
}
#login-backdrop::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:.48;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.42) 0 1px, transparent 1.5px),
    linear-gradient(115deg, transparent 0 58%, rgba(34,174,234,.08) 59%, transparent 70%);
  background-size:72px 72px, 100% 100%;
  animation: mvbLoginDrift 18s linear infinite;
}
#login-backdrop::after{
  content:"";
  position:fixed;
  left:-12%;
  right:-12%;
  bottom:-72px;
  height:190px;
  pointer-events:none;
  background:
    radial-gradient(70% 90% at 50% 100%, rgba(34,174,234,.32), transparent 68%),
    linear-gradient(180deg, rgba(143,220,255,.10), rgba(34,174,234,.18));
  border-top:1px solid rgba(143,220,255,.28);
  border-radius:50% 50% 0 0 / 42% 42% 0 0;
}
@keyframes mvbLoginDrift{
  from{ background-position:0 0, 0 0; }
  to{ background-position:72px 72px, 0 0; }
}
#login-backdrop .login-modal{
  position:relative;
  z-index:1;
  width:min(640px, calc(100vw - 32px));
  padding: clamp(22px, 3.2vw, 34px);
  border-radius:28px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.96), rgba(246,251,255,.91)),
    radial-gradient(circle at 0 0, rgba(143,220,255,.32), transparent 42%);
  border:1px solid rgba(203,213,225,.82);
  box-shadow:
    0 34px 90px rgba(0,0,0,.34),
    0 0 0 1px rgba(255,255,255,.56) inset;
  backdrop-filter: blur(18px);
}
body.dark #login-backdrop .login-modal{
  background:
    linear-gradient(145deg, rgba(9,25,43,.94), rgba(10,32,56,.90)),
    radial-gradient(circle at 0 0, rgba(34,174,234,.24), transparent 44%);
  border-color:rgba(255,255,255,.16);
}
#login-backdrop .login-brand-header{
  margin:0 auto 26px;
  max-width:430px;
}
#login-backdrop .login-brand-icon{
  width:74px !important;
  height:74px !important;
  max-width:74px !important;
  max-height:74px !important;
  border-radius:24px !important;
  box-shadow:
    0 18px 40px rgba(34,174,234,.30),
    0 0 0 8px rgba(255,255,255,.42),
    0 0 0 1px rgba(148,163,184,.28);
}
#login-backdrop .login-brand-header h3{
  font-size:clamp(1.55rem, 3.8vw, 2.05rem);
  letter-spacing:-.045em;
  margin-top:14px;
}
#login-backdrop .login-brand-subtitle{
  font-size:1.02rem;
  opacity:.76;
}
#login-backdrop #login-form > p{
  font-size:.98rem;
  line-height:1.45;
  margin:0 0 18px;
}
#login-backdrop .field label{
  font-size:.76rem;
  letter-spacing:.04em;
}
#login-backdrop .field input{
  min-height:54px;
  border-radius:16px;
  font-size:1rem;
}
#login-backdrop .help-text{
  font-size:.76rem;
  margin-top:6px;
}
#login-backdrop .login-actions{
  gap:10px;
  margin-top:22px;
}
#login-backdrop .login-actions .btn{
  min-height:46px;
  border-radius:999px;
}
#login-backdrop #login-save{
  flex-basis:100%;
  min-height:52px;
  box-shadow:0 18px 36px rgba(34,174,234,.26);
}
@media (max-width:640px){
  #login-backdrop{
    align-items:stretch;
    padding:max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }
  #login-backdrop .login-modal{
    width:100%;
    min-height:calc(100svh - 28px);
    display:flex;
    align-items:center;
  }
  #login-backdrop .login-modal form{
    width:100%;
  }
  #login-backdrop .login-brand-icon{
    width:68px !important;
    height:68px !important;
    max-width:68px !important;
    max-height:68px !important;
  }
}


/* =========================
   TRIP PLANNER UI CLEANUP
========================== */

/* Reduce outer padding around planner block */
.trip-planner{
  margin-top: 6px !important;
}

/* Tighter buttons container */
.trip-planner-buttons{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Make details (Trip Planner) not so tall */
.trip-planner-details > summary{
  padding: 8px 12px !important;
}

/* Deck + Ship Guide row */
.trip-planner-buttons a.trip-planner-deck-btn{
  flex: 0 0 auto;
  margin: 0 !important;
}

/* If they wrap on small screens, keep it nice */
@media (min-width: 700px){
  .trip-planner-buttons{
    flex-wrap: nowrap;
  }
}

/* Reduce spacing inside the planner sections */
.trip-planner .planner-sections{
  margin-top: 8px !important;
}

/* Reduce padding inside planner sections */
.trip-planner .planner-section{
  padding: 8px !important;
}

/* Confirmations & Documents */
.trip-planner .planner-docs-upload{
  display: grid;
  grid-template-columns: 1.4fr .8fr 1.2fr auto;
  gap: 8px;
  align-items: center;
  margin: 6px 0 8px;
}

.trip-planner .planner-docs-upload input[type="file"]{
  width: 100%;
}

.trip-planner .planner-docs-empty{
  font-size: .9rem;
  color: var(--muted, #9ca3af);
  padding: 6px 0 8px;
}

.trip-planner .doc-row .planner-actions{
  display:flex;
  gap: 8px;
  align-items:center;
}

@media (max-width: 760px){
  .trip-planner .planner-docs-upload{
    grid-template-columns: 1fr;
  }
  .trip-planner .doc-row .planner-actions{
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}




/* Docs: metadata polish (icon, size, date, badges) */
.trip-planner .doc-title{
  display:flex;
  gap: 8px;
  align-items: center;
}

.trip-planner .doc-icon{
  width: 20px;
  height: 20px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex: 0 0 auto;
}

.trip-planner .doc-meta{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.trip-planner .doc-meta-line{
  color: var(--muted, #9ca3af);
  font-size: .85rem;
}

.trip-planner .doc-meta .dot{
  opacity: .6;
  padding: 0 6px;
}

/* Label badge */
.trip-planner .doc-badge{
  --badge: var(--accent, #38bdf8);
  display:inline-flex;
  align-items:center;
  gap: 6px;
  font-size: .78rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.28);
  background: rgba(56,189,248,.10);
  color: var(--text, #e5e7eb);
  line-height: 1.2;
}

/* Badge variants (best-effort) */
.trip-planner .doc-badge--hotel{ --badge: var(--accent, #38bdf8); background: rgba(56,189,248,.10); }
.trip-planner .doc-badge--flight{ --badge: var(--accent-2, #0878bd); background: rgba(8,120,189,.10); }
.trip-planner .doc-badge--excursion{ --badge: var(--success, #22c55e); background: rgba(34,197,94,.10); }
.trip-planner .doc-badge--transfers{ --badge: rgba(148,163,184,1); background: rgba(148,163,184,.10); }
.trip-planner .doc-badge--cruise-confirmation{ --badge: var(--accent, #38bdf8); background: rgba(56,189,248,.10); }
.trip-planner .doc-badge--shareholder-benefit{ --badge: var(--success, #22c55e); background: rgba(34,197,94,.10); }

.trip-planner .doc-badge{
  border-color: color-mix(in srgb, var(--badge) 35%, rgba(148,163,184,.28));
}


/* =========================
   TRIP PLANNER UI CLEANUP v2
========================== */

/* Kill extra padding around the whole planner block */
.trip-planner{
  margin-top: 4px !important;
}

/* Stack buttons vertically */
.trip-planner-buttons{
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

/* Main Trip Planner button tighter */
.trip-planner-details > summary{
  padding: 6px 12px !important;
}

/* Secondary row (Deck + Ship Guide) */
.trip-planner-secondary{
  display: flex;
  gap: 8px;
  margin-top: 0 !important;
}

/* Buttons tighter */
.trip-planner-buttons a.trip-planner-deck-btn{
  margin: 0 !important;
  padding: 6px 12px !important;
}

/* Reduce spacing inside expanded planner */
.trip-planner .planner-sections{
  margin-top: 6px !important;
}

.trip-planner .planner-section{
  padding: 8px !important;
}


/* =========================
   TRIP PLANNER UI CLEANUP v3
   - Remove outer padding around the Trip Planner button
   - Deck Plan + Ship Guide share one row under Trip Planner
========================== */

/* Remove the "card-like" padding/border on the <details> wrapper (the summary already looks like a button) */
.trip-planner details.trip-planner-details{
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

/* Reduce extra space above the buttons */
.trip-planner-buttons{
  margin-top: 6px !important;
  gap: 10px !important;
}

/* Secondary row: Deck + Guide on one line */
.trip-planner-secondary{
  display: flex !important;
  gap: 10px !important;
  width: 100%;
}

/* Make both buttons share the row nicely */
.trip-planner-secondary .trip-planner-deck-btn{
  flex: 1 1 0 !important;
  min-width: 0;
}

/* On small phones, allow wrap if needed */
@media (max-width: 420px){
  .trip-planner-secondary{ flex-wrap: wrap; }
  .trip-planner-secondary .trip-planner-deck-btn{ flex: 1 1 100% !important; }
}



/* =========================
   TRIP PLANNER UI CLEANUP v4
   Make Trip Planner full-width and match secondary row
========================== */

/* Make the main Trip Planner summary button span full width */
.trip-planner-buttons details.trip-planner-details > summary{
  width: 100% !important;
  display: flex;
  justify-content: center;   /* center label */
}

/* Secondary row should fill full width */
.trip-planner-secondary{
  width: 100%;
}

/* Make each secondary button take half width so the row matches the main button */
.trip-planner-secondary .trip-planner-deck-btn{
  flex: 1 1 0;
  text-align: center;
}

/* Keep heights visually consistent */
.trip-planner-buttons a.trip-planner-deck-btn,
.trip-planner-buttons details.trip-planner-details > summary{
  min-height: 44px;
}



/* =========================
   TRIP PLANNER FULL-WIDTH v5
========================== */

/* The buttons column should stretch children full width */
.trip-planner-buttons{
  align-items: stretch !important;
}

/* Ensure the <details> fills the row */
.trip-planner-details{
  width: 100% !important;
  flex: 0 0 auto;
}

/* Make the <summary> behave like a full-width button */
.trip-planner-details > summary{
  display: flex !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Secondary row stays full width; buttons share space */
.trip-planner-secondary{
  width: 100% !important;
  display: flex !important;
  gap: 10px;
}

.trip-planner-secondary .trip-planner-deck-btn{
  flex: 1 1 0;
  width: 100%;
}

/* Tiny screens: allow wrap */
@media (max-width: 420px){
  .trip-planner-secondary{
    flex-wrap: wrap;
  }
  .trip-planner-secondary .trip-planner-deck-btn{
    flex: 1 1 100%;
  }
}

/* =========================
   PORTS STATS VIEW
========================== */
.ports-stats-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 1400px){
  .ports-stats-grid{ grid-template-columns: 1fr; }
}
.ports-stat{
  background: var(--kpi-bg, rgba(15,23,42,.90));
  border: 1px solid var(--kpi-border, rgba(148,163,184,.35));
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--kpi-shadow, 0 10px 26px rgba(0,0,0,.40));
}
.ports-stat-label{
  font-size: .72rem;
  color: var(--muted);
}
.ports-stat-value{
  margin-top: 4px;
  font-size: 1.05rem;
  font-weight: 750;
}
.ports-stat-sub{
  margin-top: 2px;
  font-size: .72rem;
  color: var(--muted);
}

.ports-leaderboard{
  margin-bottom: 14px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
}
.ports-leaderboard-title{
  font-size: .75rem;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.ports-leaderboard-list{
  margin: 0;
  padding-left: 18px;
}
.ports-leaderboard-list li{
  display:flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  font-size: .82rem;
}
.lb-name{ color: var(--text); }
.lb-count{
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.port-stat-row{
  border-radius: 12px;
  border: 1px solid var(--row-border);
  background: var(--row-bg);
  margin-bottom: 8px;
  overflow: hidden;
}
.port-stat-summary{
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.port-stat-summary::-webkit-details-marker{ display:none; }
.port-stat-name{
  font-weight: 700;
  font-size: .9rem;
}
.port-stat-meta{
  display:flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.port-stat-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 34px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  font-size: .82rem;
}
.port-stat-sub{
  font-size: .72rem;
  color: var(--muted);
}
.port-stat-trips{
  padding: 10px 12px 12px;
  border-top: 1px solid var(--surface-border);
  background: rgba(0,0,0,.06);
}
.port-trip-item{
  display:flex;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(148,163,184,.18);
}
.port-trip-item:last-child{ border-bottom: none; }

.port-trip-main{
  display:flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.port-trip-excursions{
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(148,163,184,.20);
  border-radius: 12px;
  background: rgba(0,0,0,.04);
}
.port-exc-item{
  display:flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.port-exc-name,
.port-exc-link{
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
}
.port-exc-link:hover{ text-decoration: underline; }
.port-exc-meta{
  font-size: .72rem;
  color: var(--muted);
}
.trip-pill.booked{
  border-color: rgba(34,197,94,.45);
  background: rgba(34,197,94,.14);
  color: var(--text);
}
.trip-pill.interested{
  border-color: rgba(56,189,248,.45);
  background: rgba(56,189,248,.12);
  color: var(--text);
}
.trip-pill{
  font-size: .68rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}
.trip-pill.upcoming{
  border-color: rgba(34,197,94,.55);
  color: rgba(34,197,94,.95);
}
.trip-pill.past{
  border-color: rgba(148,163,184,.45);
  color: var(--muted);
}
.trip-line{
  font-size: .8rem;
  color: var(--text);
}


/* =========================
  Latitude progress tracker
========================== */
.lat-tracker{ margin-top:10px; }
.lat-tracker-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:6px;
}
.lat-tracker-label{
  font-size:.68rem;
  color: var(--muted);
}
.lat-tracker-meta{
  font-size:.68rem;
  color: var(--muted);
  opacity:.95;
  white-space:nowrap;
}
.lat-track{
  height:10px;
  border-radius:999px;
  border:1px solid var(--kpi-border);
  background: rgba(2,6,23,.35);
  overflow:hidden;
}
body.light .lat-track{ background: rgba(2,6,23,.08); }
.lat-fill{
  height:100%;
  border-radius:999px;
  background: linear-gradient(90deg, var(--accent), #0ea5e9, var(--accent-2));
  box-shadow: 0 0 18px rgba(56,189,248,.35);
  width:0%;
  transition: width .35s ease;
}


/* =========================
   EMPTY STATE: GETTING STARTED LINK
========================== */
.empty-actions{ margin-top:10px; display:flex; gap:8px; flex-wrap:wrap; }
.empty-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--surface-border);
  background: var(--surface);
  color: var(--accent);
  text-decoration:none;
  font-size:.74rem;
  font-weight:650;
}
.empty-link:hover{ filter: brightness(1.06); }


/* =========================
   PORTS MAP (Leaflet)
========================== */
.ports-map-wrap{ margin-top: 6px; }
#ports-map{
  position: relative;
  height: 420px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  background: rgba(2,6,23,.35);
}
@media (max-width: 600px){
  #ports-map{ height: 320px; }
}


/* Map legend */

/* Route playback day banner */
.ports-map-day-banner{
  position:absolute;
  top:0;
  left:50%;
  transform:translate(-50%, -105%);
  z-index:700;
  max-width:calc(100% - 28px);
  padding:7px 12px;
  border-radius:0 0 14px 14px;
  border:1px solid rgba(56,189,248,.32);
  border-top:0;
  background:rgba(15,23,42,.9);
  color:#e5f6ff;
  font-size:.82rem;
  font-weight:800;
  letter-spacing:.01em;
  line-height:1.2;
  text-align:center;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  box-shadow:0 12px 26px rgba(2,6,23,.28);
  pointer-events:none;
  opacity:0;
  transition:opacity .22s ease, transform .22s ease;
}
.ports-map-day-banner.is-visible{
  opacity:1;
  transform:translate(-50%, 0);
}
body.light .ports-map-day-banner{
  background:rgba(255,255,255,.94);
  color:#0f172a;
  border-color:rgba(14,165,233,.35);
  box-shadow:0 12px 26px rgba(15,23,42,.14);
}
@media (max-width:600px){
  .ports-map-day-banner{
    max-width:calc(100% - 18px);
    font-size:.74rem;
    padding:6px 10px;
  }
}

.ports-map-legend{
  display:flex;
  flex-wrap:wrap;
  gap:10px 14px;
  align-items:center;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: rgba(2,6,23,.25);
}
.ports-map-legend .pml-item{
  display:flex;
  align-items:center;
  gap:8px;
  font-size: .85rem;
  color: var(--muted);
  white-space: nowrap;
}
.ports-map-legend .pml-swatch{
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid currentColor;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.ports-map-legend .pml-past{ color:#22c55e; background:#22c55e; }
.ports-map-legend .pml-planned{ color:#38bdf8; background:#38bdf8; }
.ports-map-legend .pml-both{ color:#0878bd; background:#0878bd; }

/* Leaflet theme to match your UI */
.leaflet-container{
  font-family: system-ui,-apple-system,BlinkMacSystemFont,"SF Pro Text",sans-serif;
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip{
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--surface-border);
}
.leaflet-popup-content{ margin: 10px 12px; }
.leaflet-control-zoom a{
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--surface-border);
}
.leaflet-control-zoom a:hover{ filter: brightness(1.04); }

/* Collapsible Ports Map panel */
.ports-map-panel{
  overflow: hidden;
  max-height: 900px;
  transition: max-height .28s ease, opacity .22s ease;
  opacity: 1;
  will-change: max-height, opacity;
}
.ports-map-panel.is-collapsed{
  max-height: 0;
  opacity: 0;
}


/* Ship dropdown fallback for mobile (iOS datalist issues) */
.ship-select{ width:100%; }



/* =========================
   FINAL PAYMENT ALERTS
========================== */
.alert-list{
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid rgba(248,113,113,.35);
  border-radius: var(--radius-lg);
  background: rgba(248,113,113,.08);
  box-shadow: 0 10px 26px rgba(0,0,0,.22);
}
.alert-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.alert-title{ font-weight:700; }
.alert-sub{ color: var(--muted); font-size: .85rem; }

.alert-items{ display:flex; flex-direction:column; gap:8px; }
.alert-item{
  width:100%;
  text-align:left;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.35);
  cursor:pointer;
}
body.light .alert-item{ background: rgba(255,255,255,.65); }

.alert-item:hover{ transform: translateY(-1px); }
.alert-item:active{ transform: translateY(0px); }

.alert-item-main{ display:flex; flex-direction:column; gap:2px; }
.alert-item-name{ font-weight:700; }
.alert-item-meta{ color: var(--muted); font-size:.85rem; }
.alert-item-cta{
  font-size:.8rem;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.25);
  color: var(--text);
  opacity:.9;
}

.alert-item.info{ border-color: rgba(56,189,248,.35); }
.alert-item.warn{ border-color: rgba(245,158,11,.45); }
.alert-item.urgent{ border-color: rgba(248,113,113,.55); }

.badge.good{ border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.10); color: var(--text); }
.badge.warn{ border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.10); color: var(--text); }


/* =========================
  TRIP MODAL (Add/Edit Trip)
========================== */
.trip-modal{
  width: min(980px, calc(100% - 24px));
  max-height: min(86vh, 920px);
  display:flex;
  flex-direction:column;
}
.trip-modal-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 14px 14px 8px;
  border-bottom: 1px solid rgba(148,163,184,.22);
}
.trip-modal-top h3{
  margin:0;
  font-size: 1.05rem;
}
.trip-modal-body{
  padding: 10px 14px 14px;
  overflow:auto;
}
.trip-modal-body .card{
  margin: 0; /* the moved Add Voyage card should sit flush */
}

/* ✅ iOS/Safari scrolling fix: allow the body to shrink + scroll inside flex modal */
.trip-modal{ min-height: 0; }
.trip-modal-top{ flex: 0 0 auto; }
.trip-modal-body{ flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; }

/* If the modal ever exceeds the viewport, allow the backdrop to scroll (mobile Safari) */
.modal-backdrop{ overflow: auto; }

@media (max-width: 520px){
  .modal-backdrop{ align-items: flex-start; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .trip-modal{ max-height: 92svh; }
}

/* Keep the form comfortable on smaller screens */
@media (max-width: 520px){
  .trip-modal{
    width: calc(100% - 14px);
    max-height: 92vh;
  }
  .trip-modal-top{
    padding: 12px 12px 8px;
  }
  .trip-modal-body{
    padding: 10px 12px 12px;
  }
}




/* =========================
  TRIP MODAL — Desktop polish
  (Add/Edit Trip popup)
========================== */

/* Make trip modal backdrop feel more “app-like” */
#trip-modal-backdrop{
  padding: 24px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Modal container polish */
.modal.trip-modal{
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
  border: 1px solid rgba(148,163,184,.28);
}

/* Sticky header so Close is always reachable */
.trip-modal-top{
  position: sticky;
  top: 0;
  z-index: 6;
  background: linear-gradient(180deg, rgba(2,6,23,.98), rgba(2,6,23,.90));
}

/* Scroll only the body (header stays put) */
.trip-modal-body{
  overflow: auto;
}

/* Inside the modal, make the moved card feel like native content */
.trip-modal-body #trip-form-card{
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* Compact + nicer header inside the form (Edit Trip / helper text) */
.trip-modal-body #trip-form-card .card-header{
  padding: 10px 2px 12px;
  border-bottom: 1px solid rgba(148,163,184,.16);
  margin-bottom: 12px;
}
.trip-modal-body #trip-form-card .card-header h2{
  font-size: 0.95rem;
  letter-spacing: .10em;
  text-transform: uppercase;
  margin: 0;
}
.trip-modal-body #trip-form-card .card-header small{
  display:block;
  margin-top: 6px;
  color: rgba(226,232,240,.75);
}

/* Wider modal on desktop */
@media (min-width: 900px){
  .modal.trip-modal{
    width: min(1120px, calc(100% - 64px));
    max-height: min(92vh, 980px);
  }

  /* 2-column form layout */
  .trip-modal-body .field-row,
  .trip-modal-body .row{
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    align-items: start;
  }

  /* Ports + notes + footer span full width */
  .trip-modal-body #ports-list,
  .trip-modal-body .ports-list,
  .trip-modal-body #trip-notes,
  .trip-modal-body .form-footer{
    grid-column: 1 / -1;
  }

  /* Ports block gets its own soft panel so it doesn't dominate */
  .trip-modal-body #ports-list,
  .trip-modal-body .ports-list{
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(148,163,184,.20);
    background: rgba(2,6,23,.28);
  }

  /* Make action/footer area stay visible when scrolling */
  .trip-modal-body .form-footer{
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding-top: 12px;
    margin-top: 10px;
    background: linear-gradient(180deg, rgba(2,6,23,0), rgba(2,6,23,.92) 35%, rgba(2,6,23,.98));
  }

  /* Inputs feel more “desktop app” */
  .trip-modal-body input,
  .trip-modal-body select,
  .trip-modal-body textarea{
    min-height: 42px;
  }
  .trip-modal-body textarea{
    min-height: 96px;
  }
}




.help-modal {
  width: 95%;              /* nearly full width on large screens */
  max-width: 1200px;       /* allow it to grow wider */
  height: 250vh;            /* nearly full height of the screen */
  min-height: 700px;       /* optional: ensure enough height on medium screens */
}

@media (max-width: 768px) {
  .help-modal {
    width: 100%;
    max-width: none;
    height: 95vh;          /* still tall on phones/tablets */
  }
}

/* reuse the same body container as the Trip modal */
.help-modal .trip-modal-body{
  flex: 1 1 auto;
  padding: 0;
}




/* =========================
   HELP MODAL (Getting Started)
========================== */
#help-modal-backdrop{ display:none; }

.help-modal{
  width: 100%;
  max-width: 1400px;
  height: 90vh;              /* ✅ fixed height so iframe can fill */
  display: flex;
  flex-direction: column;
}

.help-modal .trip-modal-body{
  flex: 1 1 auto;
  padding: 0;
  display: flex;             /* ✅ let iframe stretch */
}

#help-iframe{
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
/* =========================
   HELP / GETTING STARTED MODAL
========================== */
.help-modal{
  width: 95vw;
  max-width: 1200px;   /* big desktop size */
  height: 92vh;
  padding: 0;          /* let iframe fill it */
  display: flex;
  flex-direction: column;
}

/* Modal body should fill remaining space */
.help-modal .trip-modal-body{
  flex: 1;
  padding: 0;
  display: flex;
}

/* Iframe fills modal */
#help-iframe{
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0 0 16px 16px;
}

/* Mobile: go full screen */
@media (max-width: 768px){
  .help-modal{
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}
/* =========================
   HELP MODAL — Mobile fullscreen
========================== */
@media (max-width: 768px){
  /* Backdrop should fill the screen and not "float" */
  #help-modal-backdrop{
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  /* Make the modal true fullscreen */
  .help-modal{
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;      /* better than 100vh on iOS */
    border-radius: 0 !important;
    margin: 0 !important;
  }

  /* Make header feel app-like */
  .help-modal .trip-modal-top{
    padding: 14px 14px 10px !important;
  }

  /* Ensure iframe can scroll */
  .help-modal .trip-modal-body{
    flex: 1;
    min-height: 0;                 /* important for iOS flex scrolling */
  }

  #help-iframe{
    width: 100%;
    height: 100%;
    border-radius: 0 !important;
  }
}



@media (max-width: 768px){
  

  
}



@media (max-width: 768px){
  

  
}



@media (max-width: 768px){
  

  
}

/* =========================
   HELP MODAL — hard overrides
   (prevents .modal max-height from shrinking the iframe on mobile)
========================== */
.modal.help-modal{
  max-height: none;
  overflow: hidden; /* keep iframe clean; iframe handles scrolling */
}

@media (max-width: 768px){
  .modal.help-modal{
    max-height: none;
    height: 100dvh; /* iOS-friendly fullscreen */
  }

  /* iOS safe-area padding for the header */
  .modal.help-modal .trip-modal-top{
    padding-top: calc(14px + env(safe-area-inset-top)) !important;
  }
}


/* =========================
  SHARE LINK COPY MODAL
========================== */
.copy-overlay{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.copy-modal{
  width: min(620px, 92vw);
  background: var(--surface, rgba(17,24,39,.95));
  border: 1px solid var(--surface-border, rgba(148,163,184,.25));
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  padding: 14px;
}
.copy-modal h3{ margin: 0 0 10px; font-size: 1.05rem; }
.copy-row{ display:flex; gap:10px; align-items:center; }
.copy-input{
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--surface-border, rgba(148,163,184,.25));
  background: rgba(255,255,255,.06);
  color: var(--text, #e5e7eb);
}
.copy-actions{
  display:flex; gap:10px; justify-content:flex-end;
  margin-top: 12px;
}
@media (max-width: 520px){
  .copy-row{ flex-direction: column; align-items: stretch; }
  .copy-row .btn{ width: 100%; }
  .copy-actions .btn{ width: 100%; }
}



/* =========================
   SHARE STATUS LINE + CHECKLIST
========================== */
.trip-shareline{
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  background: rgba(56,189,248,.08);
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
}
.trip-shareline-text{
  font-size: .85rem;
  color: var(--text);
  font-weight: 650;
}
.trip-shareline-actions{
  display:flex;
  gap: 8px;
}
.btn.btn-small{
  padding: 6px 10px;
  border-radius: 10px;
  font-size: .82rem;
}

#trip-checklist-body{
  display:flex;
  flex-direction: column;
  gap: 8px;
}
.check-item{
  border-radius: 12px;
  border: 1px solid var(--row-border, var(--surface-border));
  background: var(--row-bg, rgba(255,255,255,.03));
  padding: 10px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}
.check-left{
  display:flex;
  flex-direction: column;
  gap: 4px;
}
.check-title{
  font-weight: 750;
  font-size: .92rem;
}
.check-badges{
  display:flex;
  flex-wrap: wrap;
  gap: 6px;
}
.badge.bad{
  background: rgba(249,115,115,.12);
  border-color: rgba(249,115,115,.35);
  color: var(--text);
}
.badge.warn{
  background: rgba(251,191,36,.14);
  border-color: rgba(251,191,36,.35);
  color: var(--text);
}
.badge.good{
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.35);
  color: var(--text);
}
/* Trips header filter pill (Hide past trips) */
.trip-header-actions{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.check-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--surface-border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
  user-select:none;
  line-height:1;
}
.check-pill input{
  width:16px;
  height:16px;
  accent-color: var(--accent);
}
@media (max-width:600px){
  .check-pill{ padding:7px 9px; }
}


/* =========================================================
   Trip Modal – Theme-aware header & footer (LIGHT MODE FIX)
   Prevents overly-dark bars on Add/Edit Trip
========================================================= */
body.light .trip-modal-top{
  background: linear-gradient(
    180deg,
    rgba(255,255,255,.96),
    rgba(255,255,255,.88)
  );
  border-bottom-color: rgba(148,163,184,.35);
}

body.light .trip-modal-body .form-footer{
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0),
    rgba(255,255,255,.82) 35%,
    rgba(255,255,255,.96)
  );
}

/* Ports panel inside modal should also respect light mode */
body.light .trip-modal-body #ports-list,
body.light .trip-modal-body .ports-list{
  background: rgba(255,255,255,.75);
  border-color: rgba(148,163,184,.35);
}


/* =========================
   MOBILE (iPhone) NAV POLISH
========================== */
@media (max-width: 640px){
  /* Slim header */
  .title small{ display:none !important; }               /* hide tagline */
  .chip #privacy-chip-text{ display:none !important; }   /* hide status text, keep dot */
  .chip{ padding: 8px 10px !important; gap: 8px !important; }
  .logo-img{ width: 48px !important; height: 48px !important; border-radius: 14px !important; }
  .title h1{ font-size: 1.05rem !important; }

  /* Hide desktop action row (moved to More sheet) */
  .action-stack{ display:none !important; }

  /* Move main tabs to bottom tab bar on mobile */
  .tabs{ display:none !important; }

  /* Give the main content room above the bottom bar */
  main{ padding-bottom: calc(88px + env(safe-area-inset-bottom)) !important; }
}

/* Bottom tab bar (mobile only) */
.mobile-tabbar{
  display:none;
}
@media (max-width: 640px){
  .mobile-tabbar{
    display:grid;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    grid-template-columns: repeat(6, 1fr);
    background: rgba(2,6,23,.92);
    border-top: 1px solid var(--surface-border);
    backdrop-filter: blur(14px);
    z-index: 1000;
  }
  .mobile-tabbar .m-tab{
    appearance:none;
    border:0;
    background:transparent;
    color: var(--muted);
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap: 4px;
    padding: 8px 4px;
    min-height: 64px;
  }
  .mobile-tabbar .m-ico{ font-size: 1.1rem; line-height: 1; }
  .mobile-tabbar .m-lbl{ font-size: .68rem; letter-spacing: .01em; }
  .mobile-tabbar .m-tab.active{ color: var(--accent); }

  /* Pulse the Alerts tab icon when there are checklist issues */
  .mobile-tabbar .m-tab[data-tab="checklist"].has-alerts .m-ico{
    animation: alertsPulse 1.6s ease-in-out infinite;
  }
}

@keyframes alertsPulse{
  0%{ transform: scale(1); }
  50%{ transform: scale(1.18); }
  100%{ transform: scale(1); }
}

@media (prefers-reduced-motion: reduce){
  .mobile-tabbar .m-tab[data-tab="checklist"].has-alerts .m-ico{
    animation: none;
  }
}

/* More sheet (mobile only) */
.mobile-more-backdrop{
  display:none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1200;
  align-items: flex-end;
  justify-content: center;
  padding: 14px;
}
.mobile-more-sheet{
  width: min(560px, 100%);
  /* Use theme tokens so the sheet matches dark/light mode */
  background: var(--surface-2);
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
  overflow:hidden;
}
.mobile-more-hdr{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 12px 12px;
  border-bottom: 1px solid var(--surface-border);
  background: var(--surface-2);
}
.mobile-more-title{
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text);
}
.mobile-more-close{
  padding: 10px 12px !important;
  min-width: 44px;
}
.mobile-more-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
}
@media (max-width: 380px){
  .mobile-more-grid{ grid-template-columns: 1fr; }
}
.mobile-more-foot{
  padding: 0 12px 12px;
}





/* v197: login is a true full-screen gate on every viewport.
   Keep the authenticated app hidden until login succeeds or Demo is chosen. */
body.mvb-login-open .app-shell{
  visibility:hidden !important;
  pointer-events:none !important;
}
body.mvb-login-open #login-backdrop{
  background:
    radial-gradient(circle at 18% 8%, rgba(34,174,234,.28), transparent 34%),
    radial-gradient(circle at 84% 16%, rgba(143,220,255,.18), transparent 32%),
    linear-gradient(145deg, #041222, #082c48 46%, #030d1b) !important;
}

/* =========================
   SEA THEME BRAND LOCKUP v247
========================= */
.title .brand-promise{
  display:block;
  font-size:.78rem;
  line-height:1.25;
  color:var(--muted);
}
.title .brand-tagline{
  display:block;
  margin-top:1px;
  font-size:.78rem;
  line-height:1.2;
  font-weight:800;
  color:#0878bd;
  letter-spacing:.01em;
}
html.dark .title .brand-tagline,
html.dark-theme .title .brand-tagline,
html.theme-dark .title .brand-tagline,
html[data-theme="dark"] .title .brand-tagline,
body.dark .title .brand-tagline,
body.dark-theme .title .brand-tagline,
body.theme-dark .title .brand-tagline,
body[data-theme="dark"] .title .brand-tagline,
:root[data-theme="dark"] .title .brand-tagline{
  color:#22aeea;
}
@media (max-width:640px){
  .title .brand-promise{
    display:block !important;
    font-size:.64rem !important;
    line-height:1.18;
    margin-top:1px;
    white-space:nowrap;
  }
  .title .brand-tagline{
    display:block !important;
    font-size:.66rem !important;
    margin-top:1px;
    white-space:nowrap;
  }
}
@media (max-width:390px){
  .title .brand-tagline{ font-size:.61rem !important; }
}

/* =========================
   BRAND TAGLINE ALIGNMENT v280
   Align both tagline lines with the MyVoyageBoard wordmark instead of the icon.
========================= */
.title .brand-promise,
.title .brand-tagline{
  margin-left:66px;
}
@media (max-width:640px){
  .title .brand-promise,
  .title .brand-tagline{
    margin-left:58px;
  }
}

/* =========================
   BRAND TAGLINE SPACING v264
   Pull the tagline block closer to the MyVoyageBoard wordmark while preserving v263 alignment.
========================= */
.title .brand-promise{
  margin-top:-7px;
}
@media (max-width:640px){
  .title .brand-promise{
    margin-top:-7px !important;
  }
}


/* HEADER LOGO SIZE v280
   Slightly larger dashboard brand icon to balance the personalized wordmark.
   Desktop 56px; mobile 48px. */

/* =========================
   HEADER OPTICAL ALIGNMENT v282
   The title is vertically centered beside the 56px icon by the h1 flex row,
   so a 2px nudge was too subtle. Lift only the three text lines enough to
   visually balance against the ship artwork while leaving the icon fixed.
========================= */
#app-title,
.title .brand-promise,
.title .brand-tagline{
  position:relative;
  top:-6px;
}

.title .brand-promise{
  margin-top:-9px;
}

@media (max-width:640px){
  #app-title,
  .title .brand-promise,
  .title .brand-tagline{
    top:-4px;
  }
  .title .brand-promise{
    margin-top:-8px !important;
  }
}


/* v313 Voyages flyout: keep Next Adventures grouped under Voyages. */
.voyages-menu{position:relative;display:inline-flex;align-items:stretch;}
.voyages-menu>.tab-btn{height:100%;}
.voyages-menu>.tab-btn .voyages-caret{font-size:.66rem;margin-left:2px;opacity:.72;transition:transform .16s ease;}
.voyages-menu:hover>.tab-btn .voyages-caret,.voyages-menu:focus-within>.tab-btn .voyages-caret{transform:rotate(180deg);}
.voyages-flyout{position:absolute;z-index:1200;top:calc(100% + 8px);left:0;min-width:230px;padding:8px;border:1px solid var(--border);border-radius:16px;background:var(--card);box-shadow:0 16px 36px rgba(16,53,82,.16);opacity:0;visibility:hidden;transform:translateY(-5px);pointer-events:none;transition:opacity .14s ease,transform .14s ease,visibility .14s ease;}
/* Keep the hover path connected between the Voyages pill and its flyout. */
.voyages-flyout::before{content:"";position:absolute;left:0;right:0;top:-10px;height:10px;}
.voyages-menu:hover .voyages-flyout,.voyages-menu:focus-within .voyages-flyout{opacity:1;visibility:visible;transform:translateY(0);pointer-events:auto;}
.voyages-flyout a{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:11px;color:var(--text);text-decoration:none;font-size:.84rem;font-weight:750;white-space:nowrap;}
.voyages-flyout a:hover,.voyages-flyout a:focus-visible{background:var(--soft);outline:none;}
.voyages-flyout a.active{color:#fff;background:linear-gradient(135deg,#075ba9,#0878bd);}
.voyages-flyout small{display:block;font-size:.69rem;font-weight:600;opacity:.7;margin-top:1px;}
@media(max-width:900px){.voyages-flyout{left:50%;transform:translate(-50%,-5px)}.voyages-menu:hover .voyages-flyout,.voyages-menu:focus-within .voyages-flyout{transform:translate(-50%,0)}}
